# import socket
# import time
# import threading
#
# def sendMsg(i):
#     mysock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #SOCK_DGRAM-UDP协议, SOCK_STREAM-TCP协议
#     # mysock.connect(('10.7.154.54',2425))
#     mysock.connect(('127.0.0.a.txt',2425))
#     #IPMSG报文格式: 版本号:数据包编号:发送者姓名:发送主机:命令字:消息内容:附加数据
#     version = 'a.txt.0'
#     packageID = str(time.time())
#     name = '曾哥'
#     host = '10.7.154.54'
#     command = str(0x00000020)
#     content = 'hello world. 你好, 世界.' + str(i)
#
#     msg = version + ':' + packageID + ':' + name + ':' + host + ':' + command +':' + content
#     mysock.send(msg.encode('gbk'))
#     mysock.close()
#
# if __name__ == '__main__':
#     threads = []
#     for i in range(5):
#         t = threading.Thread(target=sendMsg, args=(i,))
#         threads.append(t)
#     for t in threads:
#         t.start()
#         t.join()

import threading
import time


def fun():
    time.sleep(1)
    print(threading.currentThread().name)


threads = []
for i in range(5):
    t = threading.Thread(target=fun)
    threads.append(t)

for t in threads:
    t.start()
